package com.project.mvprxsample.ui.activity;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.project.mvprxsample.R;
import com.project.mvprxsample.bean.NetworkErrorBean;
import com.project.mvprxsample.ui.fragment.BaseFragment;
import com.project.mvprxsample.ui.fragment.FirstFragment;
import com.project.mvprxsample.view.BaseView;

import org.json.JSONException;
import org.json.JSONObject;

/**
 *  Created by lvyang on 2017/5/12.
 */
public class FragmentTestActivity extends FragmentBaseActivity implements BaseView<JSONObject> {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment);
    }

    /**
     * 初始化标题栏
     */
    @Override
    protected void initTitle() {

    }

    /**
     * 初始化控件
     */
    @Override
    protected void initView() {

    }

    /**
     * 初始化presenters
     */
    @Override
    protected void initPresenters() {

    }

    /**
     * 点击menu菜单事件
     *
     * @return
     */
    @Override
    protected void doActionMenu() {

    }

    @Override
    protected boolean hideActionBar() {
        return false;
    }

    @Override
    protected Drawable getActionMenuIcon() {
        return null;
    }

    @Override
    protected String getActionMenuText() {
        return null;
    }

    /**
     * 获取第一个fragment
     *
     * @return
     */
    @Override
    protected BaseFragment getFirstFragment() {
        return FirstFragment.newInstance("", "");
    }

    @Override
    protected int getFragmentContentId() {
        return R.id.fragment;
    }

    @Override
    public void getSuccess(JSONObject jsonObject, String tag) {

    }

    @Override
    public void getFail(NetworkErrorBean bean) {

    }

    @Override
    public void onFragmentInteraction(String tag, JSONObject json) {
        try {
            if (tag.equals(BaseFragment.SETTITLE)) {
                setTitle(json.getString("title"));
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
